<template>
  <div style="border: 1px solid #000; height: 30px; width: 300px"></div>
  <div v-cloak style="height: 30px">
    {{bool}}
  </div>
  <div>
    test22222222222
    <a-button @click="setCount">{{ addCount }}--computed</a-button>
  </div>

  <div class="hex">
    <div>
      1. 十进制和二进制互转
      <p>  十进制转二进制, 除2取余(反向余数就是结果)(13 -> 1101)</p>
      <p>  二进制转十进制 从右至左,1101 ->  1* 2^0 + 0* 2^1 + 1* 2^2 + 1* 2^3</p>
    </div>
    <div>
      2. 十进制和八进制互转
      <p>  十进制转八进制, 除8取余(反向余数就是结果)(13 -> 15)</p>
      <p>  八进制转十进制 从右至左,15 ->  3* 8^0 + 1 * 8^1 </p>
    </div>
    <div>
      3. 十进制和十六进制互转
      <p>  十进制转十六进制, 除16取余(反向余数就是结果)(17 -> 11)</p>
      <p>  十六进制转十进制 从右至左,11 -> 1* 16^0 + 1*16^1 </p>
    </div>
    <div>
      <p>toString可以把一个数转为指定进制数</p>
      <p>parseInt是把数按照指定进制解析为10进制数</p>
    </div>

  </div>
</template>
<script lang="ts" setup>
import { ref, computed, reactive, onMounted } from 'vue'
let bool = ref<boolean>()
onMounted(() => {
  setTimeout(() => {
    bool.value = true
  }, 1000)
})
interface DataItem {
  title: string
}
const count = ref(1)
const addCount = computed({
  // 获取值的时候触发
  get: () => count.value + 1,
  // 设置值的时候触发
  set: val => {
    count.value = val - 1
  }
})
const setCount = () => {
  addCount.value = Math.random()
  console.log(addCount.value)
}

// console.log((10).toString(2), '1010')

const sum = (n: number):number => {
  if (n === 1) return n
  return sum((n - 1)) + n
}
console.log(sum(100), '1 - 100')


// 
let intervals = {
  timer: null,
  task: {},
  delay: 30000
}

const getTableList = (): any => {

}

// onMounted(() => {
//   let fn = () => {
//     let keys = Object.keys(intervals.task)
//     if (keys.length <= 0) return
    
//     // 执行开始
//     clearInterval(intervals.timer)
//     getTableList().finally(() => {
//       if (intervals.timer !== null) {
//         intervals.timer = setInterval(fn, intervals.delay)
//       }
//     })
//   }

//   intervals.timer = setInterval(fn, intervals.delay)


// })




</script>
<style lang="scss" scoped>
[v-clock] {
  visibility: hidden;
}


</style>